package com.abc.ollama.vo;

import lombok.Data;
import java.util.List;

@Data
public class ChatCompletionResponse {
    private String id;
    private String object;
    private long created;
    private String model;
    private List<Choice> choices;
    private String system_fingerprint;
    private Usage usage;

    @Data
    public static class Choice {
        private int index;
        private Delta delta;
        private Message message;
        private String finish_reason;
        private ContentFilterResults content_filter_results;
    }

    @Data
    public static class Delta {
        private String content;
        private String reasoning_content;
        private String role;
    }

    @Data
    public static class Message {
        private String content;
        private String reasoning_content;
        private String role;
    }

    @Data
    public static class ContentFilterResults {
        private FilteredStatus hate;
        private FilteredStatus self_harm;
        private FilteredStatus sexual;
        private FilteredStatus violence;
    }

    @Data
    public static class FilteredStatus {
        private boolean filtered;  // true or false
    }

    @Data
    public static class Usage {
        private int prompt_tokens;
        private int completion_tokens;
        private int total_tokens;
    }

    // 提取 content 的方法
    public String getContent() {
       return choices.get(0).getDelta().getContent();
    }
}
